import request from './request.js'


export const uuid = async (): Promise<any> => {
    return await request('uuid')
}

export const types = async (): Promise<any> => {
    return await request('types')
}

export const showPrimaryKey = async (): Promise<any> => {
    return await request('showPrimaryKey')
}

export const hasColumn = async (tableName: string, columnName: any): Promise<any> => {
    return await request('hasColumn', { tableName, columnName })
}

export const dropColumn = async (tableName: string, columnName: any): Promise<any> => {
    return await request('dropColumn', { tableName, columnName })
}

export const addColumn = async (tableName: string, column: any): Promise<any> => {
    return await request('addColumn', { tableName, column })
}

export const renameColumn = async (tableName: string, column: any): Promise<any> => {
    return await request('renameColumn', { tableName, column })
}

export const showColumns = async (tableName: string, includePrimaryKey: boolean = false): Promise<any> => {
    return await request('show_columns', { tableName, includePrimaryKey })
}


export const showTables = async (): Promise<any> => {
    return await request('showTables')
}

export const hasTable = async (tableName: string): Promise<any> => {
    return await request('hasTable', { tableName })
}

export const dropTable = async (tableName: string): Promise<any> => {
    return await request('dropTable', { tableName })
}

export const truncateTable = async (tableName: string): Promise<any> => {
    return await request('truncateTable', { tableName })
}

export const renameTable = async (fromTableName: string, toTableName: string): Promise<any> => {
    return await request('renameTable', { fromTableName, toTableName })
}

export const createTable = async (tableName: string, data: any): Promise<any> => {
    return await request('create_table', { tableName, data })
}

export const insertHandler = async (tableName: string, data: any): Promise<any> => {
    return await request('insertHandler', { tableName, data })
}

export const updateHandler = async (tableName: string, where: any, data: any): Promise<any> => {
    return await request('updateHandler', { tableName, where, data })
}

export const deleteHandler = async (tableName: string, where: any): Promise<any> => {
    return await request('deleteHandler', { tableName, where })
}

export const updateByIdHandler = async (tableName: string, data: any): Promise<any> => {
    return await request('updateByIdHandler', { tableName, data })
}

export const saveHandler = async (tableName: string, data: any): Promise<any> => {
    return await request('saveHandler', { tableName, data })
}

export const deleteByIdHandler = async (tableName: string, id: any): Promise<any> => {
    return await request('deleteByIdHandler', { tableName, id })
}


export const selectHandler = async (tableName: string, methods: any): Promise<any> => {
    return await request('selectHandler', { tableName, methods })
}

export const selectWhereHandler = async (tableName: string, where: any): Promise<any> => {
    return await request('selectWhereHandler', { tableName, where })
}

export const pageHandler = async (tableName: string, page: any): Promise<any> => {
    return await request('pageHandler', { tableName, page })
}